<?php
/**
 * User not an administrator, redirect to Home page
 * automatically.
 */
if(!$session->isAdmin()){
   header("Location: ../index.php");
}
else{ ?>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function jqCheckAll3( id, pID )
{
   $( "#" + pID + " :checkbox").attr('checked', $('#' + id).is(':checked'));
}
//  End -->
</script>
<div id="form_container" style="border:none; width:800px; margin: 10px 78px 0px 78px;">
	<div id="form_text" style="margin:0px;" class="settings">
    	<h2>Banned Users List</h2>
    </div>
    <div id="form_content" class="settings" style="text-align:center">
        <div class="tableFilter">
            <form id="tableFilter" action="" method="post" onsubmit="myTable.filter(this.id); return false;"><b>Filter: </b> 
                <select id="column" class="select">
                    <option value="1">Firstname</option>
                    <option value="2">Lastname</option>
                    <option value="3">Email</option>
                </select>
                <input type="text" id="keyword" />
                <input class="submit" type="submit" value="Search" />
                <input class="submit" type="reset" value="Clear" />
            </form>
        </div>
        <form name='myForm' action='adminprocess.php' method='POST'>
        <!-- The navigation buttons between pages -->
        <?php include('../include/pagination.php');
			$orderby = 'regdate';
			$result = displayAdminActivation($orderby); ?>
        
        <!-- The table of users -->
        <table id="myTable" cellpadding="0" cellpadding="0">
            <thead>
                <th axis="string">Username</th>
                <th axis="number">User Level</th>
                <th axis="string">Email</th>
                <th axis="number">Registered</th>
                <th><input type="checkbox" id="checkL" onclick="jqCheckAll3(this.id, 'left');"/></th>
            </thead>
            <tbody>
            	<?php while ($row = $result->fetch()) {
					$regdate = $row['regdate'];
					$reg  = date("j M, y, g:i a", $regdate);	
					echo "<tr><td>".$row['username']."</td><td>".$row['userlevel']."</td><td>"
					."<a href='mailto:".$row['email']."'>".$row['email']."</a></td><td>".$reg
					."</td><td><input name='".$row['username']."' type='checkbox' value='yes' />";	
				}?>
            </tbody>
            <tfoot>
                <tr style="visibility:hidden">
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
            </tfoot>
        </table>
        <input type="hidden" name="activateusers" value="1">
        <input style="width:auto;" id="submit" class="submit" type="submit" value="Activate Selected Users">
        </form>
        </div>
	</div>
</div>
<script type="text/javascript">
	var myTable = {};
	window.addEvent('domready', function(){
		myTable = new sortableTable('myTable', {overCls: 'over', onClick: function(){}});
	});
</script>
<?php } ?>